﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ws="clr-namespace:Creventive.Wpf.ShellFactory.Workspace"
                    xmlns:wsp="clr-namespace:Creventive.Wpf.ShellFactory.Workspace.Primitives">

  <Style TargetType="{x:Type ws:WorkspaceTabStrip}">
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <TabPanel IsItemsHost="True"
                    Margin="2,2,2,0" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemTemplate">
      <Setter.Value>
        <DataTemplate>
          <DockPanel>
            <ws:CloseButton x:Name="closeButton"
                            DockPanel.Dock="Right"
                            Margin="9,1,0,0"
                            Width="15"
                            Height="15"
                            Visibility="Collapsed"
                            Command="Close"
                            CommandParameter="{Binding ApplicationView}"/>
            <TextBlock Text="{Binding Title}"
                       VerticalAlignment="Center" />
          </DockPanel>
          <DataTemplate.Triggers>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding IsActive}"
                           Value="True" />
                <Condition Binding="{Binding Workspace.AllowClose}"
                           Value="True" />
              </MultiDataTrigger.Conditions>
              <Setter TargetName="closeButton"
                      Property="Visibility"
                      Value="Visible" />
            </MultiDataTrigger>
          </DataTemplate.Triggers>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ws:WorkspaceTabStrip}">
          <Border Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}">
            <ItemsPresenter />
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>